package com.flavors.wan.main.ui;

import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;

import com.plat.sdk.R;


public class LoadingFragment extends BaseFragment {
    private ImageView mIvProgress;
    private Animation mLoadingAnim;

    @Override
    protected int getLayoutRes() {
        return R.layout.fragment_loading;
    }

    @Override
    protected void initView() {
        mIvProgress = findViewById(R.id.iv_progress);
        if (mLoadingAnim == null) {
            mLoadingAnim = AnimationUtils.loadAnimation(getRootView().getContext(), R.anim.loading_progress_rotate);
            mLoadingAnim.setRepeatCount(Animation.INFINITE);
            mLoadingAnim.setRepeatMode(Animation.RESTART);
        }
        mIvProgress.startAnimation(mLoadingAnim);
    }

    @Override
    public void onDestroyView() {
        if (mLoadingAnim != null) {
            mLoadingAnim.cancel();
        }
        super.onDestroyView();
    }
}
